# author = '李天宝'
# write in '2020/8/5 0005 9:34'
from rest_framework.views import APIView
from rest_framework.response import Response
# from rest_framework import serializers
# from rest_framework.pagination import CursorPagination

from products.models import goods_info

#这个是9.9特卖的功能
class Nine(APIView):
    """
    这个类9.9一共才4条数据，老师给的sql文件有问题
    """

    def get(self,request):
        goods=goods_info.objects.filter(selling_price=9.9).all()[:]

        return Response({
            'code':200,
            'length':len(goods),
            'detail':goods.values('id','name','cover_img','selling_price','original_price','sell_status'),
        })